26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
233 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
234 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
243 Attribute(0), CallingOnSet(false), Length01(
Track->DefaultTrackLength), Length23(-1), SpeedLimit01(
Track->DefaultTrackSpeedLimit), SpeedLimit23(-1),
244 TrainIDOnElement(-1), TrainIDOnBridgeTrackPos01(-1), TrainIDOnBridgeTrackPos23(-1), StationEntryStopLinkPos1(-1), StationEntryStopLinkPos2(-1),
245 SigAspect(FourAspect)
247 for(
int x = 0; x < 4; x++)
263 if(lower.second < higher.second)
267 else if(lower.second > higher.second)
271 else if(lower.second == higher.second)
273 if(lower.first < higher.first)
286 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
287 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
291 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
302 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
330 {2, 4}, {6, 2}, {8, 6}, {4, 8},
331 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
341 else if(
Link[2] == -1)
354 else if(
Link[2] == -1)
363 for(
int x = 0; x < 16; x++)
365 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
541 throw Exception(
"Error in EntryExitNumber 4");
636 throw Exception(
"Error in EntryExitNumber 5");
733 throw Exception(
"Error in EntryExitNumber 6");
823 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1112 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1136 AnsiString NL =
'\n';
1138 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable; " + NL + NL +
1139 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1140 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1141 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1148 int InternalLinkCheckArray[9][2] =
1149 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1154 for(
int x = 0; x < 9; x++)
1156 for(
int y = 0; y < 2; y++)
1163 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1165 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1166 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1167 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1168 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1169 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1175 int HVArray[10][2] =
1176 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1178 for(
int x = 0; x < 10; x++)
1180 for(
int y = 0; y < 2; y++)
1189 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1192 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1193 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1195 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1196 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1198 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1199 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1202 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1205 for(
int x = 0; x < 40; x++)
1211 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1214 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1215 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1217 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1218 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1220 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1221 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1224 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1227 for(
int x = 0; x < 40; x++)
1233 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1236 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1237 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1239 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1240 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1242 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1243 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1246 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1249 for(
int x = 0; x < 40; x++)
1275 for(
int x = 0; x < 40; x++)
1302 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1303 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1304 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1305 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1306 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1307 {0, 0, 129}, {0, -1, 145},
1310 for(
int x = 0; x < 25; x++)
1312 for(
int y = 0; y < 3; y++)
1320 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1321 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1322 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1323 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1324 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1325 {0, 0, 129}, {0, 1, 145},
1328 for(
int x = 0; x < 25; x++)
1330 for(
int y = 0; y < 3; y++)
1338 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1339 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1340 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1341 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1342 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1343 {0, 0, 130}, {-1, 0, 146},
1346 for(
int x = 0; x < 25; x++)
1348 for(
int y = 0; y < 3; y++)
1356 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1357 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1358 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1359 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1360 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1361 {0, 0, 130}, {1, 0, 146},
1364 for(
int x = 0; x < 25; x++)
1366 for(
int y = 0; y < 3; y++)
1374 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1375 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1376 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1377 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1378 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1379 {0, -1, 129}, {1, 0, 130},
1380 {-1, 0, 130}, {0, 1, 145},
1381 {0, -1, 145}, {1, 0, 146},
1384 for(
int x = 0; x < 28; x++)
1386 for(
int y = 0; y < 3; y++)
1404 for(
int x = 0; x < 8; x++)
1406 for(
int y = 0; y < 3; y++)
1424 for(
int x = 0; x < 8; x++)
1426 for(
int y = 0; y < 3; y++)
1444 for(
int x = 0; x < 8; x++)
1446 for(
int y = 0; y < 3; y++)
1464 for(
int x = 0; x < 8; x++)
1466 for(
int y = 0; y < 3; y++)
1474 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1476 for(
int x = 0; x < 4; x++)
1478 for(
int y = 0; y < 3; y++)
1486 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1487 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1488 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1489 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1495 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1496 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1497 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1498 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1504 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1505 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1506 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1507 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1513 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1514 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1515 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1516 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1538 delete UGMIt->second;
1614 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1615 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1617 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1624 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1625 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1638 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1639 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1641 {4, 6, 2, 8}, {1, 9, 3, 7},
1643 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1645 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1648 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1649 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1650 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1651 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1652 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1653 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1654 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1656 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1657 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1658 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1659 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1660 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1661 {4, 6, -1, -1}, {2, 8, -1, -1},
1663 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1665 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1667 {4, 6, -1, -1}, {2, 8, -1, -1},
1672 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1673 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1674 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1675 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1678 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1679 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1680 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1682 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1683 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1684 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1686 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1688 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1689 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1690 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1691 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1692 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1693 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1694 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1695 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1696 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1697 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1698 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1699 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1700 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1702 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1703 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1704 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1705 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1706 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1707 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1708 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1709 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1713 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1714 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1715 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1721 for(
int x = 0; x < 17; x++)
1723 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1725 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1729 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1735 ExistingGraphicLoaded(false), Width(16), Height(16)
1747 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1785 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1789 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1793 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1797 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1820 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1823 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1827 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1831 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1865 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1886 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1900 bool TrackPresent =
false;
1914 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1918 TrackPresent =
true;
1923 return(!TrackPresent);
1931 bool TrackPresent =
false;
1940 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1944 TrackPresent =
true;
1950 return(!TrackPresent);
1955 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1958 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1959 TrackEraseSuccessfulFlag =
false;
1964 ErasedTrackVectorPosition = -1;
1965 AnsiString SName =
"", ErrorString;
1967 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1973 TrackMapKeyPair.first = HLocInput;
1974 TrackMapKeyPair.second = VLocInput;
1975 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1986 if(ErrorString !=
"")
1988 throw Exception(ErrorString +
" for EraseTrackElement 1");
2012 ErasedTrackVectorPosition = VecPos;
2013 TrackEraseSuccessfulFlag =
true;
2019 unsigned int VecPos;
2020 InactiveTrackMapKeyPair.first = HLocInput;
2021 InactiveTrackMapKeyPair.second = VLocInput;
2026 VecPos = InactiveTrack2MultiMapIterator->second;
2031 if(ErrorString !=
"")
2033 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2043 TrackEraseSuccessfulFlag =
true;
2064 VecPos = InactiveTrack2MultiMapIterator->second;
2069 if(ErrorString !=
"")
2071 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2095 if(TrackEraseSuccessfulFlag)
2117 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2118 bool PlatAllowedFlag =
false;
2120 TrackLinkingRequiredFlag =
false;
2132 LocationNameEntry.first =
"";
2140 TempTrackElement.
HLoc = HLocInput;
2141 TempTrackElement.
VLoc = VLocInput;
2167 else if(Aspect == 1)
2171 else if(Aspect == 2)
2175 else if(Aspect == 3)
2184 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2187 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2189 if(InactiveFoundFlag)
2193 NonStationOrLevelCrossingPresent =
true;
2197 NonStationOrLevelCrossingPresent =
true;
2201 PlatformPresent =
true;
2212 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2220 PlatAllowedFlag =
true;
2224 PlatAllowedFlag =
true;
2228 PlatAllowedFlag =
true;
2232 PlatAllowedFlag =
true;
2236 TrackLinkingRequiredFlag =
true;
2264 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2265 (!FoundFlag && !InactiveFoundFlag))
2268 TrackLinkingRequiredFlag =
true;
2300 TrackLinkingRequiredFlag =
true;
2312 else if(FoundFlag || InactiveFoundFlag)
2331 bool BothPointFillets =
true;
2346 TrackLinkingRequiredFlag =
true;
2360 bool InternalChecks)
2364 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2365 bool PlatAllowedFlag =
false;
2367 TrackLinkingRequiredFlag =
false;
2370 LocationNameEntry.first =
"";
2376 TempTrackElement.
HLoc = HLocInput;
2377 TempTrackElement.
VLoc = VLocInput;
2378 for(
int x = 0; x < 4; x++)
2384 TempTrackElement.
Conn[x] = -1;
2388 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2399 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2401 if(InactiveFoundFlag)
2405 NonStationOrLevelCrossingPresent =
true;
2409 NonStationOrLevelCrossingPresent =
true;
2413 PlatformPresent =
true;
2424 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2432 PlatAllowedFlag =
true;
2436 PlatAllowedFlag =
true;
2440 PlatAllowedFlag =
true;
2444 PlatAllowedFlag =
true;
2448 TrackLinkingRequiredFlag =
true;
2479 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2480 (!FoundFlag && !InactiveFoundFlag))
2483 TrackLinkingRequiredFlag =
true;
2518 TrackLinkingRequiredFlag =
true;
2530 else if(FoundFlag || InactiveFoundFlag)
2549 bool BothPointFillets =
true;
2564 TrackLinkingRequiredFlag =
true;
2594 ShowMessage(
"Gaps must be set before track can be validated");
2604 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2615 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2632 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2639 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2663 std::pair<AnsiString, char>TempMapPair;
2671 TempMapPair.second =
'x';
2681 AnsiString Name =
"";
2682 typedef std::list<AnsiString> TNoPlatsList;
2683 TNoPlatsList::iterator NPLIt;
2684 TNoPlatsList NoPlatsList;
2685 typedef std::list<AnsiString> TLocNameList;
2686 TLocNameList LocNameList;
2691 LocNameList.push_back(LNMMIt->first);
2694 LocNameList.unique();
2695 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2699 if(MMRange.first == MMRange.second)
2705 if((LNMMIt->second) < 0)
2719 TempIt = MMRange.second;
2720 if(LNMMIt == --TempIt)
2722 NoPlatsList.push_back(Name);
2726 if(!NoPlatsList.empty())
2728 AnsiString NoPlatsAnsiList =
"";
2729 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2731 NoPlatsAnsiList += *NPLIt +
'\n';
2735 if(NoPlatsList.size() > 1)
2737 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2741 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2756 int NewHLoc, NewVLoc;
2757 bool ConnectionFoundFlag, LinkFoundFlag;
2759 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2761 for(
unsigned int y = 0; y < 4; y++)
2779 ConnectionFoundFlag =
false;
2780 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2786 ConnectionFoundFlag =
true;
2788 LinkFoundFlag =
false;
2789 for(
unsigned int a = 0; a < 4; a++)
2793 LinkFoundFlag =
true;
2809 if(!ConnectionFoundFlag)
2884 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2901 bool UnsetGaps =
false;
2908 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2912 for(
unsigned int y = 0; y < 4; y++)
2924 for(
unsigned int y = 0; y < 4; y++)
2934 for(
unsigned int y = 1; y < 4; y++)
2943 for(
unsigned int y = 0; y < 4; y++)
2956 for(
unsigned int y = 0; y < 4; y++)
2984 int NumberOfActiveElements = 0;
2986 GraphicsFollow =
false;
2990 if(MarkerString[MarkerString.Length()] ==
'1')
2992 GraphicsFollow =
true;
2994 for(
int x = 0; x < NumberOfActiveElements; x++)
3000 TrackElement.
HLoc = TempInt;
3002 TrackElement.
VLoc = TempInt;
3008 TrackElement.
Conn[0] = TempInt;
3032 if((TempInt != -1) && (TempInt < 10))
3042 if((TempInt != -1) && (TempInt < 10))
3059 if(Marker[1] ==
'3')
3063 else if(Marker[1] ==
'2')
3067 else if(Marker[1] ==
'G')
3081 int NumberOfInactiveElements = 0;
3085 for(
int x = 0; x < NumberOfInactiveElements; x++)
3091 TrackElement.
HLoc = TempInt;
3093 TrackElement.
VLoc = TempInt;
3099 bool LocError =
false;
3128 for(
int x = 0; x < NumberOfGraphics; x++)
3139 bool FileError =
false;
3141 for(
int x = 0; x < NumberOfGraphics; x++)
3154 UGME.second =
new TPicture;
3155 UGME.second->LoadFromFile(
UGME.first);
3158 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3165 catch(
const EInvalidGraphic &e)
3174 delete UGMIt->second;
3179 catch(
const Exception &e)
3188 delete UGMIt->second;
3196 bool FoundInMap =
false;
3215 UGME.second =
new TPicture;
3216 UGME.second->LoadFromFile(
UGME.first);
3219 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3226 catch(
const EInvalidGraphic &e)
3235 delete UGMIt->second;
3240 catch(
const Exception &e)
3249 delete UGMIt->second;
3274 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3278 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3280 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3283 VecFile << x <<
'\n';
3284 VecFile << TrackElement.
SpeedTag <<
'\n';
3285 VecFile << TrackElement.
HLoc <<
'\n';
3286 VecFile << TrackElement.
VLoc <<
'\n';
3290 VecFile << TrackElement.
Conn[0] <<
'\n';
3294 VecFile << TrackElement.
Attribute <<
'\n';
3300 VecFile << int(1) <<
'\n';
3304 VecFile << int(0) <<
'\n';
3307 VecFile << TrackElement.
Length01 <<
'\n';
3308 VecFile << TrackElement.
Length23 <<
'\n';
3311 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3318 VecFile <<
"3*****" <<
'\0' <<
'\n';
3322 VecFile <<
"2*****" <<
'\0' <<
'\n';
3326 VecFile <<
"G*****" <<
'\0' <<
'\n';
3330 VecFile <<
"4*****" <<
'\0' <<
'\n';
3335 VecFile <<
"******" <<
'\0' <<
'\n';
3340 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3344 VecFile << x <<
'\n';
3345 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3346 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3347 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3348 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3349 VecFile <<
"******" <<
'\0' <<
'\n';
3364 GraphicsFollow =
false;
3366 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3372 AnsiString MarkerString;
3379 if(MarkerString[MarkerString.Length()] ==
'1')
3381 GraphicsFollow =
true;
3383 for(
int x = 0; x < NumberOfActiveElements; x++)
3391 int SpeedTag = TempInt;
3398 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3404 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3409 if((SpeedTag > 87) && (SpeedTag < 96))
3412 if((TempInt < -1) || (TempInt > 3))
3418 if((TempInt < -1) || (TempInt > 999999))
3424 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3425 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3428 if((TempInt < -1) || (TempInt > 5))
3434 if((SpeedTag >= 68) && (SpeedTag <= 75))
3437 if((TempInt != 0) && (TempInt != 1))
3444 if((TempInt < -1) || (TempInt > 999999))
3450 if((TempInt < -1) || (TempInt > 999999))
3456 if((TempInt < -1) || (TempInt > 999999))
3462 if((TempInt < -1) || (TempInt > 999999))
3483 int NumberOfInactiveElements = 0;
3486 if(NumberOfInactiveElements < 0)
3496 for(
int x = 0; x < NumberOfInactiveElements; x++)
3510 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3516 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3543 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3549 AnsiString FileName =
"", TempStr =
"";
3551 for(
int x = 0; x < NumberOfGraphics; x++)
3553 TPicture *TempPicture =
new TPicture;
3562 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3575 catch(
const EInvalidGraphic &e)
3580 for(
int y = x + 1; y < NumberOfGraphics; y++)
3586 ShowMessage(FileName +
3587 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3592 catch(
const Exception &e)
3597 for(
int y = x + 1; y < NumberOfGraphics; y++)
3603 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3604 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3622 for(
int x = 0; x < VecSize; x++)
3645 for(
int x = 0; x < VecSize; x++)
3667 for(
int x = 0; x < VecSize; x++)
3721 for(
int x = 0; x < VecSize; x++)
3779 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3801 if(BothPointFilletsAndBasicLCs)
3876 Bitmap->Canvas->CopyMode = cmSrcCopy;
3878 Graphics::TBitmap *GraphicOutput;
4053 for(
int x = 0; x < 40; x++)
4082 Graphics::TBitmap *GraphicPtr;
4097 Graphics::TBitmap* SignalPlatformGraphic;
4130 if(OldTransparentColour !=
clB5G5R5)
4153 Bitmap->Canvas->CopyMode = cmSrcCopy;
4181 Bitmap->Canvas->CopyMode = cmSrcCopy;
4183 Graphics::TBitmap *GraphicOutput;
4193 if(BaseElement == 1)
4283 for(
int x = 0; x < 40; x++)
4312 Graphics::TBitmap *GraphicPtr;
4327 Graphics::TBitmap* SignalPlatformGraphic;
4388 for(
int x = 0; x < 40; x++)
4396 Graphics::TBitmap* SignalPlatformGraphic;
4417 if(OldTransparentColour !=
clB5G5R5)
4431 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4503 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4517 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4543 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4568 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4598 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4669 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4684 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4713 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4720 throw Exception(
"Error - Map & Vector different sizes");
4722 unsigned int NonZeroCount = 0;
4724 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4733 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4739 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4743 TrackMapEntry.first = TrackMapKeyPair;
4744 TrackMapEntry.second = x;
4745 if(!(
TrackMap.insert(TrackMapEntry).second))
4747 throw Exception(
"Error - map insertion failure, TrackVector in error");
4751 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4753 for(
unsigned int y = 0; y < 4; y++)
4778 THVPair GapMapKeyPair, GapMapValuePair;
4781 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4787 GapMapEntry.first = GapMapKeyPair;
4790 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4794 GapMapEntry.second = GapMapValuePair;
4797 GapMap.insert(GapMapEntry);
4810 bool CheckForLinks =
false;
4812 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4824 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4825 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4826 "can't connect to an underpass or vice versa)");
4834 for(
unsigned int y = 0; y < 4; y++)
4836 CheckForLinks =
false;
4854 bool ConnectionFoundFlag;
4858 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4864 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4873 if(ConnectionFoundFlag)
4877 bool LinkFoundFlag =
false;
4881 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4887 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4893 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4901 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4907 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4914 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4918 CheckForLinks =
true;
4922 for(
unsigned int a = 0; a < 4; a++)
4931 LinkFoundFlag =
true;
4944 throw Exception(
"Error in final track linkage - invalid link");
4958 throw Exception(
"Error in final track linkage - connection not found");
4971 bool ConnErrorFlag =
false;
4973 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4977 ConnErrorFlag =
true;
4981 ConnErrorFlag =
true;
4985 ConnErrorFlag =
true;
4989 ConnErrorFlag =
true;
4997 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5006 throw Exception(
"ConnError in LinkTrack - Final");
5010 throw Exception(
"ConnError in LinkTrack - Precheck");
5013 bool CLkErrorFlag =
false;
5015 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5019 CLkErrorFlag =
true;
5023 CLkErrorFlag =
true;
5027 CLkErrorFlag =
true;
5031 CLkErrorFlag =
true;
5039 throw Exception(
"CLkError in LinkTrack - Final");
5043 throw Exception(
"CLkError in LinkTrack - Precheck");
5047 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5077 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5093 for(
unsigned int y = 0; y < 4; y++)
5112 bool ConnectionFoundFlag;
5118 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5127 if(ConnectionFoundFlag)
5130 bool LinkFoundFlag =
false;
5187 for(
unsigned int a = 0; a < 4; a++)
5196 LinkFoundFlag =
true;
5204 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5214 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5227 bool ConnErrorFlag =
false;
5229 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5233 ConnErrorFlag =
true;
5237 ConnErrorFlag =
true;
5241 ConnErrorFlag =
true;
5245 ConnErrorFlag =
true;
5253 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5262 throw Exception(
"ConnError in LinkTrack - Final");
5266 throw Exception(
"ConnError in LinkTrack - Precheck");
5269 bool CLkErrorFlag =
false;
5271 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5275 CLkErrorFlag =
true;
5279 CLkErrorFlag =
true;
5283 CLkErrorFlag =
true;
5287 CLkErrorFlag =
true;
5295 throw Exception(
"CLkError in LinkTrack - Final");
5299 throw Exception(
"CLkError in LinkTrack - Precheck");
5303 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5332 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5348 for(
unsigned int y = 0; y < 4; y++)
5367 bool ConnectionFoundFlag =
false;
5369 if(ConnectionFoundFlag)
5373 bool LinkFoundFlag =
false;
5393 for(
unsigned int a = 0; a < 4; a++)
5402 LinkFoundFlag =
true;
5422 bool ConnErrorFlag =
false;
5424 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5428 ConnErrorFlag =
true;
5432 ConnErrorFlag =
true;
5436 ConnErrorFlag =
true;
5440 ConnErrorFlag =
true;
5448 bool CLkErrorFlag =
false;
5450 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5454 CLkErrorFlag =
true;
5458 CLkErrorFlag =
true;
5462 CLkErrorFlag =
true;
5466 CLkErrorFlag =
true;
5484 int Position1, Position2;
5490 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5492 int HLoc1 = GapMapPtr->first.first;
5493 int VLoc1 = GapMapPtr->first.second;
5494 int HLoc2 = GapMapPtr->second.first;
5495 int VLoc2 = GapMapPtr->second.second;
5498 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5502 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5506 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5510 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5528 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5529 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5539 bool FoundFlag =
false;
5551 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5552 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5553 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5582 bool FoundFlag =
false;
5595 TrackMapKeyPair.first = TrackElement.
HLoc;
5596 TrackMapKeyPair.second = TrackElement.
VLoc;
5597 TrackMapEntry.first = TrackMapKeyPair;
5602 LocationNameEntry.second = -(int)(
TrackVector.size());
5642 TrackMapKeyPair.first = HLoc;
5643 TrackMapKeyPair.second = VLoc;
5644 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5654 return(TrackMapPtr->second);
5667 TrackMapKeyPair.first = HLoc;
5668 TrackMapKeyPair.second = VLoc;
5669 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5672 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5673 throw Exception(Message);
5691 MapKeyPair.first = HLoc;
5692 MapKeyPair.second = VLoc;
5693 MapPtr = Map.find(MapKeyPair);
5694 if(MapPtr == Map.end())
5696 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5697 throw Exception(Message);
5702 return(Vector.at(MapPtr->second));
5712 THVPair InactiveTrackMapKeyPair;
5715 InactiveTrackMapKeyPair.first = HLoc;
5716 InactiveTrackMapKeyPair.second = VLoc;
5720 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5721 throw Exception(Message);
5735 bool Present =
true;
5739 TrackMapKeyPair.first = HLoc;
5740 TrackMapKeyPair.second = VLoc;
5741 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5756 bool Present =
true;
5757 THVPair InactiveTrackMapKeyPair;
5760 InactiveTrackMapKeyPair.first = HLoc;
5761 InactiveTrackMapKeyPair.second = VLoc;
5779 THVPair InactiveTrackMapKeyPair;
5784 InactiveTrackMapKeyPair.first = HLoc;
5785 InactiveTrackMapKeyPair.second = VLoc;
5794 if(InactiveTrackRange.first == InactiveTrackRange.second)
5803 RetPair.first = InactiveTrackRange.first->second;
5804 RetPair.second = (--InactiveTrackRange.second)->second;
5817 AnsiString(DivergingPosition));
5828 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5829 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5830 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5831 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5832 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5833 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5834 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5835 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5836 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5837 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5838 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5839 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5873 throw Exception(
"Error, Wrong track type in PlotGap");
5875 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5879 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5883 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5887 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5891 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5895 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5899 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5903 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5907 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5911 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5915 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5919 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5923 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5927 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5931 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5935 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
5951 PosPair.first = TrackElement.
HLoc;
5952 PosPair.second = TrackElement.
VLoc;
5956 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
5969 throw Exception(
"Error, Wrong track type in PlotPoints");
5980 else if(TrackElement.
SpeedTag < 132)
5998 else if(TrackElement.
SpeedTag < 132)
6031 throw Exception(
"Error, Wrong track type in PlotSignal");
6033 for(
int x = 0; x < 40; x++)
6104 for(
int x = 0; x < 40; x++)
6111 Graphics::TBitmap* SignalPlatformGraphic;
6198 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6206 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6214 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6222 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6238 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6246 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6254 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6262 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6295 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6307 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6319 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6331 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6373 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6375 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6377 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6380 if(BaseElementSpeedTag == 1)
6384 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6391 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6399 Graphics::TBitmap *RouteGraphic;
6401 if(TypeOfRoute == 1)
6405 else if(TypeOfRoute == 0)
6411 RouteGraphic = BaseGraphic;
6418 if(UpStep == DownStep)
6421 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6431 else if((DownStep - UpStep) == 1)
6436 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6446 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6459 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6469 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6485 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6495 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6505 else if(DownStep == 0)
6508 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6518 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6531 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6541 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6551 for(
int x = (UpStep + 1); x < DownStep; x++)
6556 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6560 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6581 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6588 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6594 Graphics::TBitmap *RouteGraphic;
6596 if(TypeOfRoute == 1)
6600 else if(TypeOfRoute == 0)
6606 RouteGraphic = BaseGraphic;
6615 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6625 else if((RStep - LStep) == 1)
6630 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6640 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6653 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6663 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6679 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6689 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6702 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6712 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6725 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6735 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6745 for(
int x = (LStep + 1); x < RStep; x++)
6750 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6754 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6778 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6781 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6783 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6785 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6788 if(BaseElementSpeedTag == 1)
6792 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6799 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6805 if(UpStep == DownStep)
6816 else if((DownStep - UpStep) == 1)
6835 for(
int x = (UpStep + 1); x < DownStep; x++)
6844 for(
int x = (UpStep + 1); x < DownStep; x++)
6851 for(
int x = UpStep; x <= DownStep; x++)
6864 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6871 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
6888 else if((RStep - LStep) == 1)
6907 for(
int x = (LStep + 1); x < RStep; x++)
6916 for(
int x = (LStep + 1); x < RStep; x++)
6923 for(
int x = LStep; x <= RStep; x++)
6942 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
6944 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6946 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
6949 if(BaseElementSpeedTag == 1)
6953 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
6960 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
6966 for(
int x = UpStep; x < (DownStep + 1); x++)
6981 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
6988 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
6994 for(
int x = LStep; x < (RStep + 1); x++)
7013 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7016 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7018 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7020 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7025 if(BaseElementSpeedTag == 1)
7029 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7036 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7042 for(
int x = UpStep; x <= DownStep; x++)
7056 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7063 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7069 for(
int x = LStep; x <= RStep; x++)
7085 Graphics::TBitmap *RouteGraphic;
7088 if(BaseElementSpeedTag == 1)
7090 if(TypeOfRoute == 1)
7094 else if(TypeOfRoute == 0)
7100 RouteGraphic = BaseGraphic;
7104 RouteGraphic = BaseGraphic;
7110 if(TypeOfRoute == 1)
7114 else if(TypeOfRoute == 0)
7120 RouteGraphic = BaseGraphic;
7124 RouteGraphic = BaseGraphic;
7129 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7134 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7138 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7145 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7148 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7153 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7158 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7162 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7169 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7172 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7297 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7301 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7332 "," + AnsiString(VLoc));
7336 int DummyRouteNumber;
7338 TrainPresent =
false;
7342 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7344 TrackMapKeyPair.first = HLoc;
7345 TrackMapKeyPair.second = VLoc + UpStep;
7346 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7355 TrainPresent =
true;
7369 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7371 TrackMapKeyPair.first = HLoc;
7372 TrackMapKeyPair.second = VLoc + DownStep;
7373 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7382 TrainPresent =
true;
7396 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7398 TrackMapKeyPair.first = HLoc + LeftStep;
7399 TrackMapKeyPair.second = VLoc;
7400 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7409 TrainPresent =
true;
7423 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7425 TrackMapKeyPair.first = HLoc + RightStep;
7426 TrackMapKeyPair.second = VLoc;
7427 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7436 TrainPresent =
true;
7456 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7473 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7476 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7482 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7489 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7495 for(
int x = UpStep; x <= DownStep; x++)
7502 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7509 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7515 for(
int x = LStep; x <= RStep; x++)
7531 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7538 else if(TrackElement.
SpeedTag < 132)
7556 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7573 AnsiString(ScreenPosV));
7588 AnsiString(ScreenPosV));
7599 AnsiString(VPosTrue));
7613 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7625 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7626 " in TrackMap, Caller=" + (AnsiString)Caller);
7628 if(MapVecPos != (
int)a)
7630 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7631 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7632 (AnsiString)Caller);
7638 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7639 " Caller=" + (AnsiString)Caller);
7659 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7660 " in InactiveMap, Caller=" + (AnsiString)Caller);
7662 if((InactivePair.first != a) && (InactivePair.second != a))
7664 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7665 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7666 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7671 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7672 " Caller=" + (AnsiString)Caller);
7682 int Position1, Position2;
7688 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7690 int HLoc1 = GapMapPtr->first.first;
7691 int VLoc1 = GapMapPtr->first.second;
7692 int HLoc2 = GapMapPtr->second.first;
7693 int VLoc2 = GapMapPtr->second.second;
7696 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7700 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7704 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7708 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7712 unsigned int GapCount = 0;
7714 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7722 if((
GapMap.size() * 2) != GapCount)
7724 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7725 (AnsiString)Caller);
7735 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7739 throw Exception(
"Error - TrackFinished with erase element still present");
7744 AnsiString IDString;
7746 if(TrackElement.
HLoc < 0)
7748 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7752 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7754 if(TrackElement.
VLoc < 0)
7756 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7760 IDString += AnsiString(TrackElement.
VLoc);
7774 for(
int x = 1; x < String.Length() + 1; x++)
7776 if(String.IsDelimiter(
"-", x))
7781 if(x == String.Length())
7785 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7795 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7800 if(DelimPos == String.Length())
7804 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7809 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7813 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7820 if(String.SubString(1, 1) !=
"N")
7822 for(
int x = 1; x < DelimPos; x++)
7824 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7828 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7835 if(String.SubString(1, 1) ==
"N")
7837 for(
int x = 2; x < DelimPos; x++)
7839 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7843 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7850 if(String.SubString(1, 1) ==
"N")
7852 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7856 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7858 if(String.SubString(DelimPos + 1, 1) !=
"N")
7860 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7862 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7866 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7873 if(String.SubString(DelimPos + 1, 1) ==
"N")
7875 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
7877 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7881 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7888 if(String.SubString(DelimPos + 1, 1) ==
"N")
7890 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
7894 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
7899 TrackMapPtr =
TrackMap.find(HVPair);
7904 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
7910 return(TrackMapPtr->second);
7921 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
7922 int HLoc = TrackElement.
HLoc;
7923 int VLoc = TrackElement.
VLoc;
8026 AnsiString(SpeedTag));
8037 if(HVRange.first == HVRange.second)
8044 HVIt1 = HVRange.first;
8049 if(--HVRange.second != HVRange.first)
8051 HVIt2 = HVRange.second;
8055 HVIt2->second).
SpeedTag == SpeedTag)))
8075 AnsiString(SpeedTag));
8141 AnsiString TestString1, TestString2;
8146 throw Exception(
"LNPendingList size not 1 on entry");
8148 int CurrentElementNumber;
8154 int H = CurrentElement->HLoc;
8155 int V = CurrentElement->VLoc;
8156 int Tag = CurrentElement->SpeedTag;
8162 for(
int x = 0; x < 25; x++)
8172 for(
int x = 0; x < 25; x++)
8182 for(
int x = 0; x < 25; x++)
8192 for(
int x = 0; x < 25; x++)
8202 for(
int x = 0; x < 28; x++)
8212 for(
int x = 0; x < 8; x++)
8222 for(
int x = 0; x < 8; x++)
8232 for(
int x = 0; x < 4; x++)
8242 for(
int x = 0; x < 8; x++)
8252 for(
int x = 0; x < 8; x++)
8265 if(CurrentElementNumber > -1)
8270 if((ExistingName !=
"") && (ExistingName != LocationName))
8286 AddName(1, CurrentElement, LocationName);
8290 LNDone2MultiMapEntry.first = HVPair;
8301 bool FoundFlag, ErasedFlag =
false;
8303 if(SNRange.first != SNRange.second)
8307 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8314 TVIt->LocationName =
"";
8315 TVIt->ActiveTrackElementName =
"";
8348 std::pair<AnsiString, char>TempMapPair;
8356 TempMapPair.second =
'x';
8374 AnsiString(SpeedTag));
8384 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8391 int MapPos = -1 - Position;
8395 FoundElement = MapPos;
8411 FoundElement = IMPair.first;
8420 FoundElement = IMPair.second;
8441 AnsiString OldName = TrackElement->LocationName, ErrorString;
8443 TrackElement->LocationName = Name;
8444 int HLoc = TrackElement->HLoc;
8445 int VLoc = TrackElement->VLoc;
8459 if(ErrorString !=
"")
8461 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8485 if(LNDone2MultiMapIterator->second == MapPos)
8512 if(*LNPendingListIterator == MapPos)
8585 if(NameBeingChecked !=
"")
8591 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8599 NameBeingChecked = LNMMRg.second->first;
8601 if(NameBeingChecked !=
"")
8607 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8628 if(LNMMIt->second < 0)
8638 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8646 std::list<THVPair> HVLinkedList;
8649 HVPairsLinkedMap.begin()->second =
true;
8650 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8653 THVPair HVPairUnderExamination;
8654 THVPairsLinkedMap::iterator HVPLMIt;
8656 while(!HVLinkedList.empty())
8658 HVPairUnderExamination = HVLinkedList.front();
8659 HVLinkedList.pop_front();
8660 HVPairNew.first = HVPairUnderExamination.first;
8661 HVPairNew.second = HVPairUnderExamination.second - 1;
8662 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8663 if(HVPLMIt != HVPairsLinkedMap.end())
8665 if(!HVPLMIt->second)
8667 HVLinkedList.push_back(HVPLMIt->first);
8669 HVPLMIt->second =
true;
8671 HVPairNew.first = HVPairUnderExamination.first - 1;
8672 HVPairNew.second = HVPairUnderExamination.second;
8673 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8674 if(HVPLMIt != HVPairsLinkedMap.end())
8676 if(!HVPLMIt->second)
8678 HVLinkedList.push_back(HVPLMIt->first);
8680 HVPLMIt->second =
true;
8682 HVPairNew.first = HVPairUnderExamination.first;
8683 HVPairNew.second = HVPairUnderExamination.second + 1;
8684 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8685 if(HVPLMIt != HVPairsLinkedMap.end())
8687 if(!HVPLMIt->second)
8689 HVLinkedList.push_back(HVPLMIt->first);
8691 HVPLMIt->second =
true;
8693 HVPairNew.first = HVPairUnderExamination.first + 1;
8694 HVPairNew.second = HVPairUnderExamination.second;
8695 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8696 if(HVPLMIt != HVPairsLinkedMap.end())
8698 if(!HVPLMIt->second)
8700 HVLinkedList.push_back(HVPLMIt->first);
8702 HVPLMIt->second =
true;
8707 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8709 if(!HVPLMIt->second)
8728 if(LocationName ==
"")
8739 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8746 ActiveTrackElementNameMapEntry.second = 0;
8768 bool FoundFlag, ErasedFlag =
false;
8772 if(SNRange.first != SNRange.second)
8775 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8778 TVIt->LocationName =
"";
8779 TVIt->ActiveTrackElementName =
"";
8813 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8815 AnsiString LocationName;
8824 if(LocationName !=
"")
8832 if(LocationName !=
"")
8846 if(LocationName !=
"")
8848 int ModifiedPosition = -1 - Position;
8857 for(
int x = 0; x < 25; x++)
8867 else if(SpeedTag == 77)
8869 for(
int x = 0; x < 25; x++)
8879 else if(SpeedTag == 78)
8881 for(
int x = 0; x < 25; x++)
8891 else if(SpeedTag == 79)
8893 for(
int x = 0; x < 25; x++)
8903 else if(SpeedTag == 96)
8905 for(
int x = 0; x < 28; x++)
8915 else if(SpeedTag == 129)
8917 for(
int x = 0; x < 8; x++)
8927 else if(SpeedTag == 130)
8929 for(
int x = 0; x < 8; x++)
8939 else if(SpeedTag == 145)
8941 for(
int x = 0; x < 8; x++)
8951 else if(SpeedTag == 146)
8953 for(
int x = 0; x < 8; x++)
8963 else if(SpeedTag == 131)
8965 for(
int x = 0; x < 4; x++)
8988 AnsiString(SpeedTag));
9000 if(TempElement->LocationName !=
"")
9002 LocationName = TempElement->LocationName;
9003 FoundElement = IMPair.first;
9011 if(TempElement->LocationName !=
"")
9013 LocationName = TempElement->LocationName;
9014 FoundElement = IMPair.second;
9026 if(TempElement->LocationName !=
"")
9028 LocationName = TempElement->LocationName;
9029 FoundElement = -1 - Position;
9045 unsigned int Count = 0;
9052 AnsiString SName, TName, ErrorString;
9054 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9060 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9061 AnsiString(Caller));
9074 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9075 AnsiString(Caller));
9082 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9083 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9088 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9094 if(ErrorString !=
"")
9096 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9098 if(SNIt->second != -1 - (
int)x)
9100 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9101 AnsiString(Caller));
9107 bool FoundFlag =
false;
9116 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9117 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9121 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9122 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9123 AnsiString(Caller));
9128 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9129 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9139 if(ErrorString !=
"")
9141 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9143 if(SNIt->second != (
int)x)
9145 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9146 AnsiString(Caller));
9156 AnsiString &ErrorString)
9164 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9166 bool FoundFlag =
false;
9170 if(SNRange.first == SNRange.second)
9172 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9174 return(SNRange.first);
9178 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9180 if(SNIterator->second < 0)
9182 int TVPos = -1 - SNIterator->second;
9184 if(TVIt == TrackElement)
9193 int ITVPos = SNIterator->second;
9195 if(ITVIt == TrackElement)
9206 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9223 LocationNameEntry.first = NewName;
9224 LocationNameEntry.second = SNIterator->second;
9238 int TruePos = -1 - Position;
9242 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9252 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9275 InactiveTrack2MultiMapIterator++)
9277 if(InactiveTrack2MultiMapIterator->second > VecPos)
9279 InactiveTrack2MultiMapIterator->second--;
9287 LocationNameMultiMapIterator++)
9289 if(LocationNameMultiMapIterator->second < 0)
9293 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9295 LocationNameMultiMapIterator->second--;
9317 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9319 if(TrackMapIterator->second > VecPos)
9321 TrackMapIterator->second--;
9329 LocationNameMultiMapIterator++)
9331 if(LocationNameMultiMapIterator->second >= 0)
9337 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9339 LocationNameMultiMapIterator->second++;
9343 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9349 if(TkEl.
Conn[0] ==
int(VecPos))
9354 if(TkEl.
Conn[0] >
int(VecPos))
9358 if(TkEl.
Conn[0] > -1)
9384 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9390 LocationNameEntry.second = -1 - TVPos;
9401 LocationNameEntry.second = ITVPos;
9443 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9475 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9503 AnsiString((
short)FirstTrack));
9504 bool LengthDifferent =
false, SpeedDifferent =
false;
9511 int EXArray[16][2] =
9513 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9514 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9517 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9518 Graphics::TBitmap *Bitmap;
9522 InLink = TrackElement.
Link[0];
9523 OutLink = TrackElement.
Link[1];
9527 InLink = TrackElement.
Link[2];
9528 OutLink = TrackElement.
Link[3];
9530 for(
int x = 0; x < 16; x++)
9532 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9539 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9558 else if(TrackElement.
SpeedTag == 54)
9562 else if(TrackElement.
SpeedTag == 55)
9573 else if(TrackElement.
SpeedTag == 58)
9577 else if(TrackElement.
SpeedTag == 59)
9582 else if(Index == 14)
9588 else if(TrackElement.
SpeedTag == 52)
9592 else if(TrackElement.
SpeedTag == 57)
9597 else if(Index == 15)
9603 else if(TrackElement.
SpeedTag == 53)
9607 else if(TrackElement.
SpeedTag == 56)
9621 if(LengthDifferent && SpeedDifferent)
9689 else if(LengthDifferent && !SpeedDifferent)
9836 AnsiString((
short)FirstTrack));
9837 LengthDifferent =
false;
9838 SpeedDifferent =
false;
9843 LengthDifferent =
true;
9847 SpeedDifferent =
true;
9849 if(LengthDifferent || SpeedDifferent)
9862 LengthDifferent =
true;
9866 SpeedDifferent =
true;
9868 if(LengthDifferent || SpeedDifferent)
9881 LengthDifferent =
true;
9885 SpeedDifferent =
true;
9887 if(LengthDifferent || SpeedDifferent)
9967 AnsiString TempName;
9968 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
9969 bool ForwardSet, ReverseSet;
9971 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9976 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10014 for(
int y = 0; y < 2; y++)
10045 StartElement = TempElement;
10046 StartVecPos = VecPos;
10049 EntryPos = 1 - Dir;
10050 StartEntryPos = 1 - Dir;
10059 VecPos = TempElement.
Conn[1 - EntryPos];
10060 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10062 EntryPos = TempEntryPos;
10090 ForwardNumber = ((Count + 1) / 2) + 1;
10091 ReverseNumber = (Count - ForwardNumber) + 1;
10093 EntryPos = 1 - Dir;
10094 TempElement = StartElement;
10095 VecPos = StartVecPos;
10096 if(Count == ForwardNumber)
10101 if(Count == ReverseNumber)
10109 VecPos = TempElement.
Conn[1 - EntryPos];
10110 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10112 EntryPos = TempEntryPos;
10114 if(Count == ForwardNumber)
10119 if(Count == ReverseNumber)
10131 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10267 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10323 if((TextH / 16) - 1 <
HLocMin)
10327 if((TextH / 16) + 1 >
HLocMax)
10331 if((TextV / 16) - 1 <
VLocMin)
10335 if((TextV / 16) + 1 >
VLocMax)
10365 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10366 bool &UserGraphicFoundFlag)
10369 TUserGraphicVector::iterator UserGraphicPtr;
10371 UserGraphicFoundFlag =
false;
10378 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10379 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10381 UserGraphicItem = x;
10382 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10383 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10384 UserGraphicFoundFlag =
true;
10402 int SpeedTag = TrackElement.
SpeedTag;
10406 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10455 return(GraphicOutput);
10463 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10466 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10479 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10480 " in InactiveTrackElementAt");
10491 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10493 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10518 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10519 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10523 if(SNRange.first == SNRange.second)
10528 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10530 if(SNIterator->second < 0)
10544 HVPair.first = InactiveElement.
HLoc;
10545 HVPair.second = InactiveElement.
VLoc;
10549 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10551 int TVPos =
TrackMap.find(HVPair)->second;
10554 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10560 FirstNamedExitPos = 0;
10562 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10564 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10565 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10568 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10570 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10571 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10572 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10575 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10585 FirstNamedExitPos = 1;
10587 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10589 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10590 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10593 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10595 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10596 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10597 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10600 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10616 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10630 AnsiString(FirstNamedElementPos));
10631 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10632 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10634 SecondNamedElementPos = -1;
10635 FirstNamedLinkedElementPos = -1;
10636 SecondNamedLinkedElementPos = -1;
10640 if(SNRange.first == SNRange.second)
10645 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10647 if(SNIterator->second < 0)
10657 HVPair.first = InactiveElement.
HLoc;
10658 HVPair.second = InactiveElement.
VLoc;
10670 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10674 int TVPos =
TrackMap.find(HVPair)->second;
10675 if(TVPos != FirstNamedElementPos)
10681 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10687 FirstNamedExitPos = 0;
10689 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10691 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10692 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10695 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10697 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10698 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10699 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10702 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10704 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10705 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10706 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10715 FirstNamedExitPos = 1;
10717 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10719 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10720 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10723 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10725 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10726 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10727 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10730 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10732 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10733 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10734 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10755 if(SNRange.first != SNRange.second)
10757 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10759 if(SNIterator->second < 0)
10781 "," + AnsiString(SpeedTag));
10792 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10822 else if(SpeedTag == 69)
10848 else if(SpeedTag == 70)
10874 else if(SpeedTag == 71)
10911 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
10912 if(NextEntryPos < 0)
10925 if(NextEntryPos > 1)
10944 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
10956 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
10957 bool FoundFlag =
false;
10972 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
10973 bool FoundFlag =
false;
10998 VPosHi = 16 * VLocHi;
10999 VPosLo = 16 * VLocLo;
11018 AnsiString(EndTVPosition));
11029 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11030 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11031 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11032 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11034 if(Link0Squares <= Link1Squares)
11052 AnsiString(LinkPos));
11071 if((LinkPos == 1) && (TE.
Attribute == 0))
11076 else if(LinkPos == 1)
11082 else if((LinkPos == 3) && (TE.
Attribute == 1))
11087 else if(LinkPos == 3)
11094 else if(LinkPos == 0)
11099 else if(LinkPos == 1)
11104 else if(LinkPos == 2)
11109 else if(LinkPos == 3)
11114 throw Exception(
"Error, failure in GetExitPos");
11163 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11167 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11209 "," + AnsiString(DiagonalLinkNumber));
11214 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11219 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11224 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11229 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11245 AnsiString JustFileName =
"";
11250 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11257 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11276 typedef std::list<int> TNamePosList;
11277 TNamePosList NamePosList;
11278 typedef TNamePosList::iterator TNPLIt;
11280 typedef std::list<int> TOnePlatList;
11281 TOnePlatList OnePlatList;
11282 typedef TOnePlatList::iterator TOPLIt;
11285 NamePosList.clear();
11286 OnePlatList.clear();
11287 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11289 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11291 NamePosList.push_back(x);
11296 if(!NamePosList.empty())
11298 OnePlatList.push_back(NamePosList.back());
11299 NamePosList.pop_back();
11301 while(!OnePlatList.empty())
11303 TempInt = OnePlatList.front();
11306 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11307 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11309 OnePlatList.push_back(TempElement.
Conn[0]);
11310 NamePosList.erase(NPLIt);
11312 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11313 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11315 OnePlatList.push_back(TempElement.
Conn[1]);
11316 NamePosList.erase(NPLIt);
11319 OnePlatList.erase(OnePlatList.begin());
11320 if(OnePlatList.empty())
11323 if(!NamePosList.empty())
11325 OnePlatList.push_back(NamePosList.back());
11326 NamePosList.pop_back();
11343 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11358 throw Exception(
"Return value negative in call to LastElementNumber");
11370 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11384 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11396 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11397 " in GetModifiablePrefDirElementAt");
11407 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11409 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11419 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11421 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11438 int TrackVectorPosition;
11490 FinishElement =
false;
11491 int TrackVectorPosition;
11513 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11523 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11546 for(
int x = 0; x < 4; x++)
11569 FinishElement =
true;
11577 for(
int x = 0; x < 4; x++)
11589 FinishElement =
true;
11597 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11604 .ELinkPos] ==
Lead))
11620 FinishElement =
true;
11639 FinishElement =
true;
11658 FinishElement =
true;
11673 FinishElement =
true;
11682 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11698 FinishElement =
true;
11704 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11727 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11728 int VectorCount = 0;
11732 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11734 for(
int x = 0; x < VectorCount; x++)
11741 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11745 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11746 SearchElement.
ELinkPos = NextELinkPos;
11767 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
11769 SearchElement.
XLinkPos = NextXLinkPos;
11795 for(
int x = 0; x < VectorCount; x++)
11807 for(
int x = 0; x < VectorCount; x++)
11821 for(
int x = 0; x < VectorCount; x++)
11835 for(
int x = 0; x < VectorCount; x++)
11845 for(
int x = 0; x < VectorCount; x++)
11856 SearchElement.
XLink = SearchElement.
Link[1];
11875 SearchElement.
XLink = SearchElement.
Link[3];
11888 for(
int x = 0; x < VectorCount; x++)
11903 XLinkPos = NextXLinkPos;
11904 CurrentTrackElement = SearchElement;
11923 throw Exception(
"Error, SearchVector empty");
11930 for(
int x = 0; x < 4; x++)
11983 throw Exception(
"Error in EntryExitNumber 1");
12002 if(PrefDirElement.
XLink == -1)
12014 if(PrefDirElement.
XLink != -1)
12018 throw Exception(
"Error in EntryExitNumber 2");
12056 LeadingPoints =
false;
12084 LeadingPoints =
true;
12100 AnsiString ErrorString;
12101 bool Error =
false;
12108 ErrorString =
"HLoc";
12114 ErrorString =
"VLoc";
12120 ErrorString =
"ELink";
12126 ErrorString =
"ELinkPos";
12132 ErrorString =
"XLink";
12138 ErrorString =
"XLinkPos";
12144 ErrorString =
"Tag";
12150 ErrorString =
"TrackVectorPosition";
12156 ErrorString =
"EXNumber";
12163 ErrorString =
"CheckCount";
12170 ErrorString =
"EntryGraphicPtr";
12176 ErrorString =
"EntryDirectionGraphicPtr";
12185 ErrorString =
"Last XLink not connected to this element";
12192 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12216 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12273 AnsiString((
short)BuildingPrefDir));
12276 if(PrefDirSize() == 0)
12281 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12293 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12305 if(x == (PrefDirSize() - 1))
12314 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12316 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12317 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12318 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12320 if(PrefDirSize() > 1)
12322 unsigned int LatestPos = PrefDirSize() - 1;
12323 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12324 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12325 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12346 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12349 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12353 H = MMIT->first.first;
12354 V = MMIT->first.second;
12357 if(PrefDirPos0 > -1)
12361 if(PrefDirPos1 > -1)
12365 if(PrefDirPos2 > -1)
12369 if(PrefDirPos3 > -1)
12373 if(PrefDirPos3 > -1)
12389 else if(PrefDirPos2 > -1)
12431 else if(PrefDirPos1 > -1)
12454 else if(PrefDirPos0 > -1)
12473 int NumberOfPrefDirElements = 0;
12476 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12478 VecFile >> TempInt;
12481 VecFile >> TempInt;
12482 LoadPrefDirElement.
ELink = TempInt;
12483 VecFile >> TempInt;
12484 LoadPrefDirElement.
ELinkPos = TempInt;
12485 VecFile >> TempInt;
12486 LoadPrefDirElement.
XLink = TempInt;
12487 VecFile >> TempInt;
12488 LoadPrefDirElement.
XLinkPos = TempInt;
12489 VecFile >> TempInt;
12490 LoadPrefDirElement.
EXNumber = TempInt;
12491 VecFile >> TempInt;
12496 if(!(LoadPrefDirElement.
IsARoute))
12522 int NumberOfPrefDirElements = 0;
12525 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12527 VecFile >> TempInt;
12528 VecFile >> TempInt;
12531 VecFile >> TempInt;
12532 LoadPrefDirElement.
ELink = TempInt;
12533 VecFile >> TempInt;
12534 LoadPrefDirElement.
ELinkPos = TempInt;
12535 VecFile >> TempInt;
12536 LoadPrefDirElement.
XLink = TempInt;
12537 VecFile >> TempInt;
12538 LoadPrefDirElement.
XLinkPos = TempInt;
12539 VecFile >> TempInt;
12540 LoadPrefDirElement.
EXNumber = TempInt;
12541 VecFile >> TempInt;
12546 if(!(LoadPrefDirElement.
IsARoute))
12574 int NumberOfPrefDirElements = 0;
12577 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12582 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12589 VecFile >> TempInt;
12590 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12595 VecFile >> TempInt;
12596 if((TempInt < -1) || (TempInt > 9))
12601 VecFile >> TempInt;
12602 if((TempInt < -1) || (TempInt > 3))
12607 VecFile >> TempInt;
12608 if((TempInt < -1) || (TempInt > 9))
12613 VecFile >> TempInt;
12614 if((TempInt < -1) || (TempInt > 3))
12619 VecFile >> TempInt;
12620 if((TempInt < -1) || (TempInt > 27))
12625 VecFile >> TempInt;
12633 VecFile >> TempInt;
12634 if((TempInt != 0) && (TempInt != 1))
12639 VecFile >> TempInt;
12640 if((TempInt != 0) && (TempInt != 1))
12645 VecFile >> TempInt;
12646 if((TempInt != 0) && (TempInt != 1))
12669 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12671 VecFile << y <<
'\n';
12672 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12682 if(y == (NumberOfPrefDirElements - 1))
12684 VecFile <<
"************" <<
'\0' <<
'\n';
12688 VecFile <<
"******" <<
'\0' <<
'\n';
12702 for(
int y = 0; y < NumberOfSearchElements; y++)
12704 VecFile << y <<
'\n';
12705 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12715 if(y == (NumberOfSearchElements - 1))
12717 VecFile <<
"************" <<
'\0' <<
'\n';
12721 VecFile <<
"******" <<
'\0' <<
'\n';
12834 bool AlreadyPresent, FoundFlag;
12835 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12837 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
12841 AlreadyPresent =
false;
12846 AlreadyPresent =
true;
12850 AlreadyPresent =
true;
12854 AlreadyPresent =
true;
12858 AlreadyPresent =
true;
12861 if(!AlreadyPresent)
12908 for(
unsigned int z = 0; z < 4; z++)
12916 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
12930 bool DiscrepancyFound =
false;
12941 DiscrepancyFound =
true;
12946 DiscrepancyFound =
true;
12951 DiscrepancyFound =
true;
12956 DiscrepancyFound =
true;
12961 DiscrepancyFound =
true;
12967 DiscrepancyFound =
true;
12970 if(DiscrepancyFound)
12972 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
12987 bool DiscrepancyFound =
false;
12998 DiscrepancyFound =
true;
13002 DiscrepancyFound =
true;
13007 DiscrepancyFound =
true;
13012 DiscrepancyFound =
true;
13017 DiscrepancyFound =
true;
13023 DiscrepancyFound =
true;
13027 return(!DiscrepancyFound);
13039 bool FoundFlag =
false;
13040 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13048 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13049 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13051 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13053 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13054 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13055 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13060 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13061 +
" Caller=" + (AnsiString)Caller);
13087 PrefDirMapKeyPair.first = HLoc;
13088 PrefDirMapKeyPair.second = VLoc;
13089 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13092 if(ItPair.first == ItPair.second)
13100 PrefDirPos0 = ItPair.first->second;
13102 if(ItPair.first == ItPair.second)
13107 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13109 PrefDirPos1 = ItPair.first->second;
13112 if(ItPair.first == ItPair.second)
13117 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13119 PrefDirPos2 = ItPair.first->second;
13122 if(ItPair.first == ItPair.second)
13127 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13129 PrefDirPos3 = ItPair.first->second;
13144 +
"," + AnsiString(LinkNumberPos));
13146 int PD0, PD1, PD2, PD3;
13147 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13151 PD0, PD1, PD2, PD3);
13163 LinkedPrefDirVectorNumber = PD0;
13172 LinkedPrefDirVectorNumber = PD1;
13182 LinkedPrefDirVectorNumber = PD0;
13191 LinkedPrefDirVectorNumber = PD1;
13200 LinkedPrefDirVectorNumber = PD2;
13209 LinkedPrefDirVectorNumber = PD3;
13214 LinkedPrefDirVectorNumber = -1;
13220 LinkedPrefDirVectorNumber = -1;
13225 catch(
const Exception &e)
13227 LinkedPrefDirVectorNumber = -1;
13239 int PD0, PD1, PD2, PD3;
13291 THVPair PrefDir4MultiMapKeyPair;
13294 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13295 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13296 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13319 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13338 AnsiString(ErasedElementNumber));
13343 if(MapPtr->second > ErasedElementNumber)
13365 throw Exception(
"PrefDirVectorPosition out of range");
13368 THVPair PrefDir4MultiMapKeyPair;
13370 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13371 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13372 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13375 if(ItPair.first == ItPair.second)
13378 return(ItPair.first);
13382 if(ItPair.first->second == PrefDirVectorPosition)
13386 return(ItPair.first);
13389 if(ItPair.first == ItPair.second)
13392 return(ItPair.first);
13394 if(ItPair.first->second == PrefDirVectorPosition)
13398 return(ItPair.first);
13401 if(ItPair.first == ItPair.second)
13404 return(ItPair.first);
13406 if(ItPair.first->second == PrefDirVectorPosition)
13410 return(ItPair.first);
13413 if(ItPair.first == ItPair.second)
13416 return(ItPair.first);
13418 if(ItPair.first->second == PrefDirVectorPosition)
13422 return(ItPair.first);
13426 return(ItPair.first);
13439 THVPair PrefDir4MultiMapKeyPair;
13441 PrefDir4MultiMapKeyPair.first = HLoc;
13442 PrefDir4MultiMapKeyPair.second = VLoc;
13443 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13446 if(ItPair.first == ItPair.second)
13454 return(ItPair.first->second);
13463 bool ErasedFlag =
false;
13465 if(ErasedTrackVectorPosition > -1)
13474 ErasedFlag =
false;
13476 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13481 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13486 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13491 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13496 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13504 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13508 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13512 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13516 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13520 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13535 OverallDistance = 0;
13536 OverallSpeedLimit = 0;
13537 LeadingPointsAtLastElement =
false;
13545 LeadingPointsAtLastElement =
true;
13554 OverallDistance += PrefDirElement.
Length23;
13555 if(OverallSpeedLimit != -1)
13565 OverallSpeedLimit = -1;
13572 OverallDistance += PrefDirElement.
Length01;
13573 if(OverallSpeedLimit != -1)
13583 OverallSpeedLimit = -1;
13602 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13605 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13609 HLoc = MMIT->first.first;
13610 VLoc = MMIT->first.second;
13615 if(PrefDirPos0 > -1)
13619 if(PrefDirPos1 > -1)
13623 if(PrefDirPos2 > -1)
13627 if(PrefDirPos3 > -1)
13631 if(PrefDirPos3 > -1)
13634 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13636 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13638 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13640 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13647 else if(PrefDirPos2 > -1)
13652 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13654 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13656 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
13665 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13667 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13669 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13678 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13680 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13682 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13689 else if(PrefDirPos1 > -1)
13694 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13696 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13704 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13706 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13712 else if(PrefDirPos0 > -1)
13714 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13731 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13734 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13755 if(PrefDirPos0 > -1)
13759 if(PrefDirPos1 > -1)
13763 if(PrefDirPos2 > -1)
13767 if(PrefDirPos3 > -1)
13771 if(PrefDirPos3 > -1)
13776 else if(PrefDirPos2 > -1)
13778 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
13789 else if(PrefDirPos1 > -1)
13791 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
13802 else if(PrefDirPos0 > -1)
13804 if(PrefDirElement0.
XLinkPos == EntryPos)
13841 ElementIn.
VLoc +
"," + XLink);
13843 bool TrackFoundFlag;
13846 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
13858 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13868 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13882 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13892 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13906 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13916 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13930 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13940 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13963 bool FoundFlag, ContFlag, FoundElements =
false;
13964 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13969 LastIteratorValue++;
13994 if(PDVIt->XLinkPos == 0)
13999 StartElement = *PDVIt;
14008 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
14010 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14011 if(PrefDirPos0 == -1)
14015 bool NextElementFoundFlag =
false;
14019 NextElementFoundFlag =
true;
14021 if(PrefDirPos1 > -1)
14026 NextElementFoundFlag =
true;
14029 if(PrefDirPos2 > -1)
14034 NextElementFoundFlag =
true;
14037 if(PrefDirPos3 > -1)
14042 NextElementFoundFlag =
true;
14045 if(!NextElementFoundFlag)
14075 EndElement = NextElement;
14079 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
14081 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14082 if(PrefDirPos0 == -1)
14092 if(PrefDirPos1 > -1)
14100 if(PrefDirPos2 > -1)
14108 if(PrefDirPos3 > -1)
14139 FoundElements =
true;
14173 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14175 int TrackVectorPosition;
14211 int LockedVectorNumber;
14234 bool InPrefDirFlag =
false;
14237 int PrefDirPos0 = -1;
14238 int PrefDirPos1 = -1;
14239 int PrefDirPos2 = -1;
14240 int PrefDirPos3 = -1;
14244 int PrefDirVecPos[4] =
14246 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14249 for(
int x = 0; x < 4; x++)
14251 int b = PrefDirVecPos[x];
14261 InPrefDirFlag =
true;
14275 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14283 if(DummyPair.first > -1)
14285 throw Exception(
"Selection in two routes - should never happen!");
14287 if(RoutePair.first > -1)
14363 IDInt &ReqPosRouteID,
bool &PointsChanged)
14397 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14447 bool InPrefDirFlag =
false;
14450 int PrefDirPos0 = -1;
14451 int PrefDirPos1 = -1;
14452 int PrefDirPos2 = -1;
14453 int PrefDirPos3 = -1;
14456 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14457 int PrefDirVecPos[4] =
14459 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14462 for(
int x = 0; x < 4; x++)
14464 int b = PrefDirVecPos[x];
14467 InPrefDirFlag =
true;
14481 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14490 if(RoutePair.first > -1)
14492 if(RoutePair.second != 0)
14509 EndElement1 = RouteElement;
14510 EndElement2 = BlankElement;
14610 PointsChanged =
true;
14638 PointsChanged =
true;
14661 PointsChanged =
true;
14690 PointsChanged =
true;
14704 PointsChanged =
true;
14723 PointsChanged =
true;
14737 PointsChanged =
true;
14753 PointsChanged =
true;
14807 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag)
14860 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
14861 AnsiString((
short)AutoSigsFlag));
14862 int VectorCount = 0;
14866 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
14870 for(
int x = 0; x < VectorCount; x++)
14878 bool FirstPass =
true;
14888 for(
int x = 0; x < VectorCount; x++)
14897 for(
int x = 0; x < VectorCount; x++)
14909 for(
int x = 0; x < VectorCount; x++)
14917 int NextPosition = PrefDirElement.
Conn[XLinkPos];
14921 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
14922 SearchElement.
ELinkPos = NextELinkPos;
14923 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
14944 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
14946 SearchElement.
XLinkPos = NextXLinkPos;
14958 for(
int x = 0; x < VectorCount; x++)
14972 if(RoutePair.first > -1)
14981 for(
int x = 0; x < VectorCount; x++)
14990 if(SecondPair.first > -1)
14999 for(
int x = 0; x < VectorCount; x++)
15013 for(
int x = 0; x < VectorCount; x++)
15024 for(
int x = 0; x < VectorCount; x++)
15033 for(
int x = 0; x < VectorCount; x++)
15042 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15046 for(
int x = 0; x < VectorCount; x++)
15056 bool InPrefDirFlag =
false;
15057 PrefDirElement1 = BlankElement;
15058 PrefDirElement2 = BlankElement;
15061 int PrefDirPos0 = -1;
15062 int PrefDirPos1 = -1;
15063 int PrefDirPos2 = -1;
15064 int PrefDirPos3 = -1;
15067 int PrefDirVecPos[4] =
15069 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15071 for(
int x = 0; x < 4; x++)
15073 int b = PrefDirVecPos[x];
15076 InPrefDirFlag =
true;
15089 for(
int x = 0; x < VectorCount; x++)
15101 for(
int x = 0; x < VectorCount; x++)
15117 for(
int x = 0; x < VectorCount; x++)
15137 for(
int x = 0; x < VectorCount; x++)
15154 for(
int x = 0; x < VectorCount; x++)
15164 for(
int x = 0; x < VectorCount; x++)
15175 int SearchPos1 = SearchElement.
Attribute + 1;
15177 if(SearchPos1 == 2)
15181 if(SearchPos1 == 1)
15189 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15190 SearchElement.
XLinkPos = SearchPos1;
15191 InPrefDirFlag =
false;
15192 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15194 SearchElement = PrefDirElement1;
15195 InPrefDirFlag =
true;
15197 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15199 SearchElement = PrefDirElement2;
15200 InPrefDirFlag =
true;
15206 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15210 for(
int x = 0; x < VectorCount; x++)
15237 for(
int x = 0; x < VectorCount; x++)
15255 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15256 SearchElement.
XLinkPos = SearchPos2;
15257 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15259 SearchElement = PrefDirElement1;
15261 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15263 SearchElement = PrefDirElement2;
15267 for(
int x = 0; x < VectorCount; x++)
15275 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15279 for(
int x = 0; x < VectorCount; x++)
15307 for(
int x = 0; x < VectorCount; x++)
15319 for(
int x = 0; x < VectorCount; x++)
15329 SearchElement = PrefDirElement1;
15338 XLinkPos = SearchElement.
XLinkPos;
15339 PrefDirElement = SearchElement;
15396 unsigned int TruncatePrefDirPosition = 0;
15469 throw Exception(
"Error - failed to validate extended route for preferred route");
15524 throw Exception(
"Error - failed to validate single route for preferred route");
15569 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
15571 int TrackVectorPosition;
15608 int LockedVectorNumber;
15642 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
15643 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
15646 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
15652 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
15653 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
15656 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
15670 if(RoutePair.first > -1)
15868 EndElement1.
ELink = EndElement1.
Link[0];
15869 EndElement1.
XLink = EndElement1.
Link[1];
15872 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
15877 EndElement2.
ELink = EndElement2.
Link[1];
15878 EndElement2.
XLink = EndElement2.
Link[0];
15881 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
15925 if(RoutePair.first > -1)
15927 if(RoutePair.second != 0)
15950 EndElement2 = BlankElement;
16035 PointsChanged =
true;
16061 PointsChanged =
true;
16083 PointsChanged =
true;
16109 PointsChanged =
true;
16123 PointsChanged =
true;
16163 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16164 int VectorCount = 0;
16167 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16168 (CurrentTrackElement.
Link[XLinkPos] == 9))
16172 for(
int x = 0; x < VectorCount; x++)
16184 for(
int x = 0; x < VectorCount; x++)
16191 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16193 for(
int x = 0; x < VectorCount; x++)
16200 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16204 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16205 SearchElement.
ELinkPos = NextELinkPos;
16226 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16228 SearchElement.
XLinkPos = NextXLinkPos;
16241 for(
int x = 0; x < VectorCount; x++)
16255 if(RoutePair.first > -1)
16264 for(
int x = 0; x < VectorCount; x++)
16273 if(SecondPair.first > -1)
16282 for(
int x = 0; x < VectorCount; x++)
16296 for(
int x = 0; x < VectorCount; x++)
16307 for(
int x = 0; x < VectorCount; x++)
16316 for(
int x = 0; x < VectorCount; x++)
16325 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16329 for(
int x = 0; x < VectorCount; x++)
16342 for(
int x = 0; x < VectorCount; x++)
16374 for(
int x = 0; x < VectorCount; x++)
16384 for(
int x = 0; x < VectorCount; x++)
16395 int SearchPos1 = SearchElement.
Attribute + 1;
16397 if(SearchPos1 == 2)
16401 if(SearchPos1 == 1)
16410 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16411 SearchElement.
XLinkPos = SearchPos1;
16413 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16417 for(
int x = 0; x < VectorCount; x++)
16442 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16443 SearchElement.
XLinkPos = SearchPos2;
16445 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16449 for(
int x = 0; x < VectorCount; x++)
16468 for(
int x = 0; x < VectorCount; x++)
16483 CurrentTrackElement = SearchElement;
16484 XLinkPos = SearchElement.
XLinkPos;
16506 throw Exception(
"Error, SearchVector empty");
16518 for(
int x = 0; x < 4; x++)
16560 throw Exception(
"Error in EntryExitNumber 3");
16615 unsigned int TruncatePrefDirPosition = 0;
16675 throw Exception(
"Failed to validate extended route for nonpreferred route");
16720 throw Exception(
"Failed to validate single route for nonpreferred route");
16740 if(!PrefDirVector.empty())
16744 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
16749 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
16784 if(!PrefDirVector.empty())
16787 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
16789 int ForwardLinkedRouteNumber, Attribute = 0;
16796 if(ForwardLinkedRouteNumber > -1)
16798 int NextForwardLinkedRouteNumber = -1;
16802 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
16812 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
16832 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
16840 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
16871 NextForwardLinkedRouteNumber = -1;
16872 for(
unsigned int x = 0; x < PrefDirSize(); x++)
16874 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
16875 if(PrefDirVector.at(x).TrackType ==
Bridge)
16877 if(PrefDirVector.at(x).XLinkPos < 2)
16879 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
16883 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
16891 if(PrefDirVector.at(x).TrackType ==
Buffers)
16903 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
16912 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
16914 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
16922 if(x == PrefDirSize() - 1)
16966 AnsiString(PrefDirVectorStartPosition));
16971 bool SkipContinuationAndBufferAttributeChange =
false;
16973 if(!PrefDirVector.empty())
16975 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
16978 if(PrefDirPtr->TrackType ==
Bridge)
16980 if(PrefDirPtr->XLinkPos < 2)
16991 SkipContinuationAndBufferAttributeChange =
true;
17006 SkipContinuationAndBufferAttributeChange =
true;
17014 SkipContinuationAndBufferAttributeChange =
true;
17016 if(!SkipContinuationAndBufferAttributeChange)
17018 if(PrefDirVector.back().TrackType ==
Buffers)
17027 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
17030 if(PrefDirPtr->TrackType ==
Bridge)
17032 if(PrefDirPtr->XLinkPos < 2)
17048 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
17057 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
17059 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
17060 PrefDirPtr->PrefDirRoute)
17064 int LockedVecNum = 0;
17066 bool KeepAttributeAt0ForLockedRoute =
false;
17071 KeepAttributeAt0ForLockedRoute =
true;
17091 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute)
17119 "," + AnsiString((
short)PrefDirRoute));
17120 bool ElementInRoute =
false;
17121 bool TrainOccupyingRoute =
false;
17127 ElementInRoute =
true;
17131 if(!ElementInRoute)
17159 TrainOccupyingRoute =
true;
17226 if(LRVIT->RouteNumber == RouteNumber)
17240 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17241 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17253 bool ExistingLockedRouteModified =
false;
17266 if(LRVIT->RouteNumber == RouteNumber)
17270 ExistingLockedRouteModified =
true;
17274 if(!ExistingLockedRouteModified)
17364 AnsiString((
short)PrefDirRoute));
17389 AnsiString((
short)PrefDirRoute));
17399 RouteFlashElement.
HLoc = H;
17400 RouteFlashElement.
VLoc = V;
17416 int H = PrefDirPtr->HLoc;
17417 int V = PrefDirPtr->VLoc;
17484 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
17490 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
17493 OverlayPlotted =
false;
17503 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17505 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
17508 return(AllRoutesVector.at(At));
17517 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17519 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
17522 return(AllRoutesVector.at(At));
17533 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17535 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
17545 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17547 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
17565 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
17566 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17569 RouteTruncateFlag =
true;
17571 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
17572 RouteTruncateFlag =
false;
17601 AnsiString(LinkPos));
17602 if(TrackVectorPosition == -1)
17607 THVPair Route2MultiMapKeyPair;
17611 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17614 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17624 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17626 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17629 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
17630 Route2MultiMapIterator->second.second);
17631 EntryLinkPos = PrefDirElement1.
ELinkPos;
17632 ExitLinkPos = PrefDirElement1.
XLinkPos;
17633 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17634 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17646 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17658 Graphics::TBitmap* &EntryDirectionGraphicPtr)
17668 AnsiString(LinkPos));
17671 if(TrackVectorPosition == -1)
17676 THVPair Route2MultiMapKeyPair;
17680 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17683 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17688 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17690 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17692 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
17693 Route2MultiMapIterator->second.second);
17694 EntryLinkPos = PrefDirElement1.
ELinkPos;
17695 ExitLinkPos = PrefDirElement1.
XLinkPos;
17696 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17697 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17701 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
17702 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17709 return(AutoSigsRoute);
17714 return(NotAutoSigsRoute);
17720 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
17721 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17728 return(AutoSigsRoute);
17733 return(NotAutoSigsRoute);
17737 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17739 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17740 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17742 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
17743 EntryLinkPos = PrefDirElement2.
ELinkPos;
17744 ExitLinkPos = PrefDirElement2.
XLinkPos;
17745 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17746 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17750 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
17757 return(AutoSigsRoute);
17762 return(NotAutoSigsRoute);
17768 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
17775 return(AutoSigsRoute);
17780 return(NotAutoSigsRoute);
17784 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
17785 EntryLinkPos = PrefDirElement3.
ELinkPos;
17786 ExitLinkPos = PrefDirElement3.
XLinkPos;
17787 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17788 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17792 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
17799 return(AutoSigsRoute);
17804 return(NotAutoSigsRoute);
17810 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
17817 return(AutoSigsRoute);
17822 return(NotAutoSigsRoute);
17838 AnsiString(LinkPos));
17839 if(TrackVectorPosition == -1)
17845 THVPair Route2MultiMapKeyPair;
17849 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17852 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17858 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17860 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17862 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
17863 Route2MultiMapIterator->second.second);
17864 EntryLinkPos = PrefDirElement1.
ELinkPos;
17865 ExitLinkPos = PrefDirElement1.
XLinkPos;
17866 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17867 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17870 RouteNumber = Route2MultiMapIterator->second.first;
17874 return(AutoSigsRoute);
17879 return(NotAutoSigsRoute);
17884 RouteNumber = Route2MultiMapIterator->second.first;
17888 return(AutoSigsRoute);
17893 return(NotAutoSigsRoute);
17897 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17899 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17900 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17902 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
17903 EntryLinkPos = PrefDirElement2.
ELinkPos;
17904 ExitLinkPos = PrefDirElement2.
XLinkPos;
17905 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17906 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17909 RouteNumber = ItPair.first->second.first;
17913 return(AutoSigsRoute);
17918 return(NotAutoSigsRoute);
17923 RouteNumber = ItPair.first->second.first;
17927 return(AutoSigsRoute);
17932 return(NotAutoSigsRoute);
17936 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
17937 EntryLinkPos = PrefDirElement3.
ELinkPos;
17938 ExitLinkPos = PrefDirElement3.
XLinkPos;
17939 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17940 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17943 RouteNumber = ItPair.second->second.first;
17947 return(AutoSigsRoute);
17952 return(NotAutoSigsRoute);
17957 RouteNumber = ItPair.second->second.first;
17961 return(AutoSigsRoute);
17966 return(NotAutoSigsRoute);
17988 EmptyRoute.
RouteID = NextRouteID;
17991 AllRoutesVector.push_back(EmptyRoute);
17992 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18017 AllRoutesVector.push_back(EmptyRoute);
18018 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18041 THVPair Route2MultiMapKeyPair;
18050 LockedRouteTruncateTrackVectorPosition = 0;
18051 LockedRouteLastTrackVectorPosition = 0;
18052 LockedRouteLastXLinkPos = 0;
18053 LockedRouteLockStartTime = TDateTime(0);
18054 if(!LockedRouteVector.empty())
18058 if(LRVIT->RouteNumber == RouteNumber)
18060 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
18061 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
18062 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
18063 LockedRouteLockStartTime = LRVIT->LockStartTime;
18064 LockedRouteFoundDuringRouteBuilding =
true;
18065 LockedRouteVector.erase(LRVIT);
18090 AnsiString(VLoc) +
"," + AnsiString(ELink));
18093 ReturnPair.first = -1;
18094 ReturnPair.second = 0;
18095 THVPair Route2MultiMapKeyPair;
18097 Route2MultiMapKeyPair.first = HLoc;
18098 Route2MultiMapKeyPair.second = VLoc;
18101 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18102 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18104 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18105 Route2MultiMapIterator = ItPair.first;
18107 if(ItPair.first == ItPair.second)
18109 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
18111 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
18113 ReturnPair.first = ItPair.first->second.first;
18114 ReturnPair.second = ItPair.first->second.second;
18115 Route2MultiMapIterator = ItPair.first;
18117 return(ReturnPair);
18120 if(ItPair.first == ItPair.second)
18122 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
18124 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
18126 ReturnPair.first = ItPair.first->second.first;
18127 ReturnPair.second = ItPair.first->second.second;
18128 Route2MultiMapIterator = ItPair.first;
18130 return(ReturnPair);
18133 return(ReturnPair);
18148 AnsiString(VLoc) +
"," + AnsiString(ELink));
18149 THVPair Route2MultiMapKeyPair;
18151 Route2MultiMapKeyPair.first = HLoc;
18152 Route2MultiMapKeyPair.second = VLoc;
18153 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18155 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18157 if(ItPair.first == ItPair.second)
18163 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18165 RouteNumber = ItPair.first->second.first;
18171 if(ItPair.first == ItPair.second)
18177 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
18179 RouteNumber = ItPair.first->second.first;
18200 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
18201 THVPair Route2MultiMapKeyPair;
18203 Route2MultiMapKeyPair.first = HLoc;
18204 Route2MultiMapKeyPair.second = VLoc;
18207 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18210 RouteElementPair.first = RouteNumber;
18211 RouteElementPair.second = RouteElementNumber;
18212 Route2MultiMapEntry.second = RouteElementPair;
18214 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
18217 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
18218 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
18221 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
18222 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
18224 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18226 Route2MultiMap.insert(Route2MultiMapEntry);
18231 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18236 Route2MultiMap.insert(Route2MultiMapEntry);
18254 TempPair.first = -1;
18255 TempPair.second = 0;
18256 SecondPair = TempPair;
18258 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
18259 THVPair Route2MultiMapKeyPair;
18261 Route2MultiMapKeyPair.first = HLoc;
18262 Route2MultiMapKeyPair.second = VLoc;
18263 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18268 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18270 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18272 return(Route2MultiMapIterator->second);
18274 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18276 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18277 TempPair = ItRange.first->second;
18278 SecondPair = (--ItRange.second)->second;
18301 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
18302 if(RouteElementPair.first == -1)
18305 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
18306 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
18308 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
18311 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18312 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
18313 (AnsiString)Caller);
18315 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
18318 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18319 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
18320 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
18321 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
18325 unsigned int SizeVal = 0;
18328 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18330 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
18332 if(SizeVal != Route2MultiMap.size())
18334 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
18335 (AnsiString)Caller);
18351 if(!Route2MultiMap.empty())
18353 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18355 if(Route2MultiMapIterator->second.first > RouteNumber)
18357 Route2MultiMapIterator->second.first--;
18374 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
18375 if(!Route2MultiMap.empty())
18377 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18379 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
18381 Route2MultiMapIterator->second.second--;
18400 AnsiString(ELink));
18404 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
18405 if(RequiredRoutePair.first == -1)
18407 throw Exception(
"Failed to find route element in RemoveRouteElement");
18409 Route2MultiMap.erase(Route2MultiMapIterator);
18410 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
18413 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
18434 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
18435 RequiredRoutePair.second)));
18446 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
18454 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
18456 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
18457 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
18458 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
18470 if(!LockedRouteVector.empty())
18474 if(LRVIT->RouteNumber > RequiredRoutePair.first)
18476 LRVIT->RouteNumber--;
18486 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
18488 AutoSigVectorIT->RouteNumber--;
18493 CheckMapAndRoutes(7);
18507 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
18508 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
18509 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
18525 "," + AnsiString(XLinkPos));
18529 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
18530 if(RouteElementPair.first == -1)
18532 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
18534 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
18536 RequiredPair = RouteElementPair;
18537 if(RouteElement.
XLinkPos != XLinkPos)
18539 if(SecondPair.first != -1)
18541 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
18542 RequiredPair = SecondPair;
18543 if(RouteElement.
XLinkPos != XLinkPos)
18545 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
18550 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
18554 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
18574 AnsiString(AccessNumber));
18576 int Attribute = AccessNumber + 1;
18578 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
18582 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
18586 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
18589 x).XLinkPos] !=
End)
18591 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
18594 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
18637 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
18638 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
18639 int RearwardLinkedRouteNumber;
18665 int TrainID, TrainPosition, BehindTrainPosition;
18666 bool FoundTrain =
false, BehindTrain =
false;
18667 for(
int x = RouteStartPosition; x >= 0; x--)
18669 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
18694 if(FoundTrain && (TrainPosition > 1))
18696 for(
int x = TrainPosition; x >= 0; x--)
18701 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
18721 BehindTrain =
true;
18722 BehindTrainPosition = x;
18729 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
18746 AnsiString(RouteTruncatePosition));
18747 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
18748 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
18751 bool ExamineRoute =
true;
18753 while(ExamineRoute)
18755 for(
int x = StartPosition; x >= 0; x--)
18797 if(SignalCount >= 3)
18816 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
18817 ExamineRoute =
true;
18818 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
18853 ExamineRoute =
false;
18868 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
18871 PrefDirElement = InternalPrefDirElement;
18872 if(LockedRouteVector.empty())
18879 bool InLockedRoute =
false;
18883 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
18887 InLockedRoute =
true;
18896 int RouteNumber, VectorCount = 0;
18901 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
18902 if(RouteType == NoRoute)
18908 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
18911 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
18913 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
18915 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
18916 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
18920 PrefDirElement = InternalPrefDirElement;
18921 LockedVectorNumber = VectorCount;
18926 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
18930 PrefDirElement = InternalPrefDirElement;
18931 LockedVectorNumber = VectorCount;
18952 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18954 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
18960 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
18970 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18972 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
18987 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18989 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
18992 return(GetFixedRouteAt(159, x));
18995 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19003 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19005 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
19008 return(GetModifiableRouteAt(15, x));
19011 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19021 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19023 TOneRoute OneRoute = GetFixedRouteAt(165, x);
19035 int NumberOfRoutes;
19039 for(
int x = 0; x < NumberOfRoutes; x++)
19046 StoreOneRouteAfterSessionLoad(0, &OneRoute);
19064 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
19071 if((NextID < 0) || (NextID > 1000000))
19076 for(
int x = 0; x < NumberOfRoutes; x++)
19101 AnsiString(StartPosition));
19102 if(EndPosition == StartPosition)
19108 int TVPos = EndPosition;
19109 int LkPos = EndXLinkPos;
19111 while(TrackIsInARoute(15, TVPos, LkPos))
19138 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19147 if((NewLkPos == 0) || (NewLkPos == 2))
19167 if(TVPos == StartPosition)
19199 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
19204 if(FirstPair.first > -1)
19207 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19212 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19218 if(SecondPair.first > -1)
19221 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19226 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19232 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
19239 if(FirstPair.first > -1)
19242 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19247 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19253 if(SecondPair.first > -1)
19256 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19261 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19267 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
19274 if(FirstPair.first > -1)
19277 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19282 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19288 if(SecondPair.first > -1)
19291 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19296 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19302 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
19309 if(FirstPair.first > -1)
19312 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19317 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19323 if(SecondPair.first > -1)
19326 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19331 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19337 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
19361 "," + AnsiString(DiagonalLinkNumber));
19366 if(FirstPair.first > -1)
19369 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19374 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19380 if(SecondPair.first > -1)
19383 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19388 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19395 if(FirstPair.first > -1)
19398 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19403 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19409 if(SecondPair.first > -1)
19412 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19417 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19424 if(FirstPair.first > -1)
19427 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19432 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19438 if(SecondPair.first > -1)
19441 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19446 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19453 if(FirstPair.first > -1)
19456 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19461 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19467 if(SecondPair.first > -1)
19470 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19475 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))